/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* iOS风格颜色变量 */
    --primary-color: #007aff;
    --primary-light: #5ac8fa;
    --success-color: #34c759;
    --error-color: #ff3b30;
    --warning-color: #ff9500;
    --text-primary: #000000;
    --text-secondary: #3c3c43;
    --text-tertiary: #8e8e93;
    --text-quaternary: #c7c7cc;
    --background-primary: #ffffff;
    --background-secondary: #f2f2f7;
    --background-tertiary: #e5e5ea;
    --background-blur: rgba(255, 255, 255, 0.72);
    --border-color: #e5e5ea;
    --separator-color: #c6c6c8;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --backdrop-blur: 20px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-medium: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-secondary);
    color: var(--text-primary);
    line-height: 1.47059;
    font-size: 16px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.container {
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--background-secondary);
}

/* 头部样式 */
.app-header {
    background-color: var(--background-primary);
    padding: 16px 20px;
    text-align: center;
    border-bottom: 1px solid var(--separator-color);
    position: relative;
    z-index: 100;
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
}

.app-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.41px;
    margin: 0;
}

.app-header .subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 2px;
    font-weight: 400;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 工资卡片样式 */
.salary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.salary-card {
    background-color: var(--background-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: none;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.salary-card:active {
    transform: scale(0.98);
    background-color: var(--background-secondary);
}

.salary-card h2 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    text-transform: none;
    letter-spacing: -0.08px;
}

.salary-amount {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.41px;
    line-height: 1.2;
}

.payday {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.41px;
    line-height: 1.2;
}

.payday span {
    color: var(--primary-color);
    font-weight: 600;
}

/* 快速操作按钮 */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.quick-action-btn {
    flex: 1;
    padding: 14px;
    background-color: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    font-size: 15px;
    font-weight: 500;
    color: var(--primary-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.quick-action-btn:active {
    transform: scale(0.96);
    background-color: var(--background-secondary);
}

/* 设置表单样式 */
.settings-form {
    background-color: var(--background-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.32px;
}

.label-icon {
    font-size: 18px;
}

.form-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    font-size: 16px;
    background-color: var(--background-secondary);
    transition: all var(--transition-fast);
    font-weight: 400;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--background-primary);
}

.form-group input[type="number"]:hover {
    border-color: var(--text-tertiary);
}

.help-text {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    display: block;
    font-weight: 400;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    padding: 12px 0;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    position: relative;
    width: 50px;
    height: 30px;
    background-color: var(--text-quaternary);
    border-radius: 15px;
    transition: background-color var(--transition-fast);
    border: 1px solid transparent;
}

.checkmark::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 26px;
    height: 26px;
    background-color: var(--background-primary);
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 0.5px solid rgba(0, 0, 0, 0.04);
}

.checkbox-container input:checked + .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-container input:checked + .checkmark::after {
    transform: translateX(20px);
}

.save-button {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: -0.41px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.save-button:active {
    transform: scale(0.98);
    background-color: #0051d5;
}

/* 重置按钮 */
.reset-button {
    width: 100%;
    padding: 12px;
    background-color: transparent;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    border-radius: var(--border-radius-lg);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.reset-button:active {
    transform: scale(0.96);
    background-color: rgba(255, 59, 48, 0.1);
}

/* 信息区域样式 */
.info-section {
    background-color: var(--background-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.info-section h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.41px;
}

.info-section h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    margin-top: 12px;
    letter-spacing: -0.24px;
}

.info-section ul {
    padding-left: 16px;
    margin: 0;
}

.info-section li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    padding-left: 4px;
}

.info-section li::before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: -12px;
    font-weight: normal;
}

.quick-tips {
    background-color: var(--background-secondary);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-top: 12px;
    border: 1px solid var(--border-color);
}

.quick-tips p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

/* 高级设置 */
.advanced-settings {
    background-color: var(--background-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.advanced-settings h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.41px;
}

.reset-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
}

/* 底部导航栏 */
.tab-bar {
    display: flex;
    background-color: var(--background-primary);
    border-top: 1px solid var(--separator-color);
    padding: 8px 0 4px 0;
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
}

.tab-button {
    flex: 1;
    padding: 8px 0;
    background: none;
    border: none;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
}

.tab-button .icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button:active {
    transform: scale(0.95);
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin-bottom: 12px;
}

.loading-overlay p {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.41px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 动画效果 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-slide-in {
    animation: slideInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-fade-in {
    animation: fadeIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-scale-in {
    animation: scaleIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 页面切换动画 */
.page-transition {
    animation: fadeIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 微交互动画 */
.salary-card {
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.salary-card:active {
    transform: scale(0.98);
    background-color: var(--background-secondary);
}

.tab-button {
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tab-button:active {
    transform: scale(0.95);
}

/* 响应式设计 */
@media (min-width: 768px) {
    .container {
        max-width: 430px;
        margin: 20px auto;
        border-radius: var(--border-radius-xl);
        overflow: hidden;
        height: calc(100vh - 40px);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border-color);
    }
    
    .app-header {
        border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
    }
    
    .salary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .salary-card:nth-child(5) {
        grid-column: 1 / -1;
    }
    
    .salary-card {
        border-radius: var(--border-radius-md);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 430px;
    }
    
    .salary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 374px) {
    .salary-amount {
        font-size: 28px;
    }
    
    .payday {
        font-size: 22px;
    }
    
    .app-header h1 {
        font-size: 20px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .salary-card {
        padding: 16px;
    }
    
    .quick-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .quick-action-btn {
        padding: 12px;
    }
}

/* 横屏模式 */
@media (orientation: landscape) and (max-height: 600px) {
    .app-header {
        padding: 12px;
    }
    
    .app-header h1 {
        font-size: 20px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .salary-card {
        padding: 16px;
    }
    
    .salary-amount {
        font-size: 28px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #ebebf5;
        --text-tertiary: #8e8e93;
        --text-quaternary: #636366;
        --background-primary: #000000;
        --background-secondary: #1c1c1e;
        --background-tertiary: #2c2c2e;
        --background-blur: rgba(28, 28, 30, 0.72);
        --border-color: #38383a;
        --separator-color: #38383a;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    }
    
    body {
        background-color: var(--background-secondary);
    }
    
    .salary-amount {
        background: linear-gradient(135deg, #5ac8fa, #34c759);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .payday span {
        color: #0a84ff;
    }
    
    .tab-button.active {
        color: #0a84ff;
    }
    
    .quick-action-btn {
        color: #0a84ff;
    }
    
    .checkbox-container input:checked + .checkmark {
        background-color: #0a84ff;
        border-color: #0a84ff;
    }
    
    .save-button {
        background-color: #0a84ff;
    }
    
    .save-button:active {
        background-color: #0051d5;
    }
}

/* 打印样式 */
@media print {
    .tab-bar,
    .app-header,
    .quick-actions,
    .loading-overlay {
        display: none;
    }
    
    .container {
        box-shadow: none;
        margin: 0;
        height: auto;
    }
    
    .main-content {
        padding: 0;
    }
    
    .salary-card {
        break-inside: avoid;
        margin-bottom: 10px;
        border: 1px solid var(--border-color);
    }
}

/* 可访问性增强 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --success-color: #00aa00;
        --error-color: #cc0000;
        --text-primary: #000000;
        --text-secondary: #333333;
        --background-primary: #ffffff;
        --background-secondary: #f0f0f0;
        --border-color: #000000;
    }
    
    .salary-card {
        border: 2px solid var(--border-color);
    }
    
    .form-group input[type="number"] {
        border: 2px solid var(--border-color);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .salary-card:hover {
        transform: none;
    }
    
    .save-button:hover,
    .reset-button:hover,
    .quick-action-btn:hover {
        transform: none;
    }
    
    .tab-button:hover {
        background-color: transparent;
    }
    
    .form-group input[type="number"]:hover {
        border-color: var(--border-color);
    }
    
    /* 触摸反馈优化 */
    .salary-card:active {
        transform: scale(0.98);
        background-color: var(--background-secondary);
    }
    
    .quick-action-btn:active {
        transform: scale(0.96);
    }
    
    .tab-button:active {
        transform: scale(0.95);
    }
    
    .save-button:active {
        transform: scale(0.98);
    }
    
    .reset-button:active {
        transform: scale(0.96);
    }
    
    /* 更大的触摸目标 */
    .salary-card {
        min-height: 44px;
    }
    
    .quick-action-btn {
        min-height: 44px;
    }
    
    .tab-button {
        min-height: 44px;
    }
}